{include file='public:common_edit'}
<style>
    .modal.in .modal-dialog{
        margin-top: 20%;
        z-index: 10000;
    }
    .modal-backdrop{
        z-index: 0;
    }
    input[type=checkbox], input[type=radio] {
        opacity: 1;
        position: inherit;
        height: 13px;
    }
</style>
<div class="page-content">
    <!-- Page Breadcrumb -->
    <div class="page-breadcrumbs">
<div class="bjy-admin-nav"><a href="{$smarty.const.__MODULE__}/Index/index"><i class="fa fa-home"></i> 首页</a> > 用户组列表 &gt; 分配权限</div>
<h1 class="text-center">为<span style="color:red">{$group_data['title']}</span>分配权限</h1>
<form action="" method="post"><input type="hidden" name="id" value="{$group_data['id']}">
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade in active" id="home">
    <table class="table table-striped table-bordered table-hover table-condensed
	">
            {foreach $rule_data as $v}
                {if !$v['_data']}
                <tr class="b-group">
                    <th width="10%"><label>{$v['title']} <input type="checkbox" name="rule_ids[]" value="{$v['id']}"
                        {if $v['id']|in_array:$group_data['rules']}checked="checked"{/if}
                        onclick="checkAll(this)" ></label></th>
                    <td></td>
                </tr>
                {else}
                <tr class="b-group">
                    <th width="10%"><label>{$v['title']} <input type="checkbox" name="rule_ids[]" value="{$v['id']}"
                        {if $v['id']|in_array:$group_data['rules']}checked="checked"{/if}
                        onclick="checkAll(this)"></label></th>
                    <td class="b-child">
                        {foreach $v['_data'] as $n}
                            <table class="table table-striped table-bordered table-hover table-condensed">
                                <tr class="b-group">
                                    <th width="10%"><label>{$n['title']} <input type="checkbox" name="rule_ids[]"
                                                                                value="{$n['id']}"
                                        {if $v['id']|in_array:$group_data['rules']}checked="checked"{/if}
                                        onclick="checkAll(this)"></label></th>
                                    <td>
                                        {if $n['_data']}
                                            {foreach $n['_data'] as $c}<label>&emsp;{$c['title']} <input
                                                    type="checkbox" name="rule_ids[]" value="{$c['id']}"
                                                    {if $c['id']|in_array:$group_data['rules']}
                                                    checked="checked"
                                                {/if}
                                                ></label>{/foreach}
                                        {/if}
                                    </td>
                                </tr>
                            </table>
                        {/foreach}
                    </td>
                </tr>
{/if}
        {/foreach}
        <tr>
            <th></th>
            <td><input class="btn btn-success" type="submit" value="提交"></td>
        </tr>
    </table>
        </div></div>
</form>
    </div>
</div>
<script src="{$smarty.const.STATIC_URL}/statics/base.js"></script>
<!--Basic Scripts-->
<script src="{$smarty.const.JS_URL}jquery-2.0.3.min.js"></script>
<script src="{$smarty.const.JS_URL}bootstrap.min.js"></script>

<!--Beyond Scripts-->
<script src="{$smarty.const.JS_URL}beyond.min.js"></script>


<!--Page Related Scripts-->
<!--Sparkline Charts Needed Scripts-->
<script src="{$smarty.const.JS_URL}charts/sparkline/jquery.sparkline.js"></script>
<script src="{$smarty.const.JS_URL}charts/sparkline/sparkline-init.js"></script>

<!--Easy Pie Charts Needed Scripts-->
<script src="{$smarty.const.JS_URL}charts/easypiechart/jquery.easypiechart.js"></script>
<script src="{$smarty.const.JS_URL}charts/easypiechart/easypiechart-init.js"></script>

<!--Flot Charts Needed Scripts-->
<script src="{$smarty.const.JS_URL}charts/flot/jquery.flot.js"></script>
<script src="{$smarty.const.JS_URL}charts/flot/jquery.flot.resize.js"></script>
<script src="{$smarty.const.JS_URL}charts/flot/jquery.flot.pie.js"></script>
<script src="{$smarty.const.JS_URL}charts/flot/jquery.flot.tooltip.js"></script>
<script src="{$smarty.const.JS_URL}charts/flot/jquery.flot.orderBars.js"></script>
<script>
    function checkAll(obj) {
        $(obj).parents('.b-group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
    }
</script>
</body>
</html>